using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class PlayAnimation : MonoBehaviour {

	public int cost = 1000;

	public Animator anim;

	public string numHotkey = "5";

	int Cost() {
		return cost;
	}

	void Update() {
		if(numHotkey != "" && Input.GetKeyDown(numHotkey)) {
			DoTrigger("Nuke");
		}
		
		transform.Find ("Cost").GetComponent<Text>().text = "$" + Cost().ToString("f0");
	}


	public void DoTrigger(string name) {
		GameManager gm = GameObject.FindObjectOfType<GameManager>();
		
		if(gm.score < Cost())
			return;
		
		gm.score -= Cost();

		anim.SetTrigger(name);
	}

}
